import { Classes } from "../../models/Classes"
import { isEmpty } from "../../utils"

// 验证注册的表单参数
export function validate(form: Classes) {
  let message = ''
  const params = new Map([
    ['class_name', '班级名称'],
    ['major_name', '专业名称'],
    ['college_name', '学院名称'],
  ])
  
  params.forEach((val, key) => {
    if (isEmpty(form[key])) {
      message = `缺少必填参数-${val}!`
    }
  })
  return message
}